/**
 * Project: complex.cache
 * 
 * File Created at 2010-7-29
 * $Id$
 * 
 * Copyright 1999-2100 Alibaba.com Corporation Limited.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Alibaba Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Alibaba.com.
 */
package com.complex.Ehcache;

import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Element;

/**
 * TODO Comment of SingleEhcacheTest
 * @author wb_liang.gao
 *
 */
public class SingleEhcacheTest {
    public static void main(String[] args) {
        //从指定文件加载配置(path的写法要注意下)
        CacheManager manager = CacheManager.create("src/main/resources/ehcache.xml");
        
        //获取EHCACHE_1 实例
        Cache cache = manager.getCache("EHCACHE_1");
        
        //定义一个Element
        Element element = new Element("key1", "value1");
        //放入缓存
        cache.put(element);
        
        System.out.println("==============================华丽的开始================================");
        //获取缓存内容
        System.out.println(cache.get("key1"));
        //删除缓存
        cache.remove("key1");
        System.out.println(cache.get("key1"));
        //关闭manager
        manager.shutdown();
    }
}
